import { defineStore } from "pinia";

export const useAppStore = defineStore("app", {
  state: () => {
    return {
      loading: false,
      isMobile: false,
      collapsed: false,
      isFixedNav: false,
      tabs: [],
      sideBarConfig: {
        mode: "inline",
        theme: "dark",
        width: 200,
        showLogo: true,
        // tagsView 是否展示 默认展示
        showTag: true,
        // 固定header
        fixedHeader: true,
      },
      headerConfig: {
        showTitle: true,
        showFullScreen: true,
        showTabs: true,
      },
      sidebarStatus: false, // 左侧栏是否展开，默认展开
    };
  },
  actions: {
    setMobile(val) {
      this.isMobile = val;
    },
    setSidebar(val) {
      this.sidebarStatus = val;
    },
    setCollapsed(val) {
      this.collapsed = val;
    },
    resetTabs() {
      this.tabs = [];
    },
  },
});
